﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignPattern
{
    public abstract class Strategy
    {
        public abstract double AcceptCash(double cash);
    }

    public class StrategyNormal : Strategy
    {
        public override double AcceptCash(double cash)
        {
            return cash;
        }
    }

    public class StrategyDiscount : Strategy
    {
        double discountPoint = 0;
        public StrategyDiscount(double point)
        {
            discountPoint = point;
        }
        public override double AcceptCash(double cash)
        {
            double result = cash * discountPoint;
            return result;
        }
    }

    public class StrategyReturn : Strategy
    {
        double unitCash = 0;
        double unitReturn = 0;
        public StrategyReturn(double unitcash,double unitreturn)
        {
            unitCash = unitcash;
            unitReturn = unitreturn;
        }
        public override double AcceptCash(double cash)
        {
            double result = cash - Math.Floor(cash / unitCash)* unitReturn;
            return result;
        }
    }
}
